void engine_init()
{
  pinMode(IN1, OUTPUT);
  pinMode(IN2, OUTPUT);
  pinMode(IN3, OUTPUT);
  pinMode(IN4, OUTPUT);
  
  pinMode(INA, OUTPUT);
  pinMode(INE, OUTPUT);
}
//停止
void car_stop()
{
  digitalWrite(IN1,LOW);
  digitalWrite(IN2,LOW);
  digitalWrite(IN3,LOW);
  digitalWrite(IN4,LOW);
}
//前进
void car_forward()
{
  digitalWrite(IN1, HIGH);
  digitalWrite(IN2, HIGH);
  digitalWrite(IN3, LOW);
  digitalWrite(IN4, LOW);
  delay(500);
  car_stop();
}
//后退
void car_backWard()
{
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, LOW);
  digitalWrite(IN3, HIGH);
  digitalWrite(IN4, HIGH);
   delay(500);
  car_stop();
}
//左转
void car_backWard()
{
  digitalWrite(IN1, HIGH);
  digitalWrite(IN2, LOW);
  digitalWrite(IN3, LOW);
  digitalWrite(IN4, HIGH);
   delay(500);
  car_stop();
}

//右转
void car_backWard()
{
  digitalWrite(IN1, LOW);
  digitalWrite(IN2, HIGH);
  digitalWrite(IN3, HIGH);
  digitalWrite(IN4, LOW);
   delay(500);
  car_stop();
}

void caar_ctrl(char ch)
{
  switch (ch)
  {
    case 'f':
    car_forward();
    case 'b':
    car_backward();
    case 'l':
    car_left();
    case 'r':
    car_right();
    case 's':
    car_stop();
  }
}



